package com.kjlink.internal.workreport.other.model;

import java.util.List;

/**
 * 描述:
 * 某日 填报日报汇总统计： 未填报的优先展示
 *
 * @author Vic.xu
 * @since 2024-05-21 9:51
 */
public class DayReportSummaryInfo {

    /**
     * 总人数
     */
    private int num;

    /**
     * 未填报人数
     */
    private int unfilledNum;

    /**
     * 填报人数
     */
    private int filledNum;

    private List<DayReportSummary> list;

    public DayReportSummaryInfo() {
    }

    public DayReportSummaryInfo(List<DayReportSummary> list) {
        this.list = list;
        if (list != null) {
            this.num = list.size();
            this.unfilledNum = (int) list.stream().filter(item -> item.getTotal() == 0).count();
            this.filledNum = this.num - this.unfilledNum;
        }
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getUnfilledNum() {
        return unfilledNum;
    }

    public void setUnfilledNum(int unfilledNum) {
        this.unfilledNum = unfilledNum;
    }

    public int getFilledNum() {
        return filledNum;
    }

    public void setFilledNum(int filledNum) {
        this.filledNum = filledNum;
    }

    public List<DayReportSummary> getList() {
        return list;
    }

    public void setList(List<DayReportSummary> list) {
        this.list = list;
    }

    public String getRate() {
        if (this.num == 0) {
            return "0.00%";
        }
        return String.format("%.2f", (double) this.filledNum / this.num * 100) + "%";
    }
}
